package com.example.kotlinlearndemo.kotlin

fun main(){
    Parent2().foo()
}

/**
 * https://kotlinlang.org/docs/returns.html
 */
open class Parent2 {

    fun foo() {
        run loop@{
            listOf(1, 2, 3, 4, 5).forEach {
                if (it == 3) return@loop // non-local return from the lambda passed to run
                print(it)
            }
        }
        print(" done with nested loop")
    }

}